/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.lanchat.model.util;

import java.io.File;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.OutputStream;

/**
 * 自定义的对象输出流，用于正确的向文件中写入多个数据
 * @author GM
 */
public class LogObjectOutputStream extends ObjectOutputStream{
    private static File f;

    private LogObjectOutputStream(OutputStream out,File f)throws IOException,SecurityException{
        super(out);
    }

    public static LogObjectOutputStream NewInstanse(File file,OutputStream out) throws IOException{
        f=file;
        return new LogObjectOutputStream(out, f);
    }
    @Override
    protected void writeStreamHeader() throws IOException{
        if(!f.exists()||(f.exists()&&f.length()==0)){
            super.writeStreamHeader();
        }
        else{

        }
    }
}
